home *** CD-ROM | disk | FTP | other *** search
- Option Explicit
- Option Compare Text
-
- 'Button type and state
- Type bType
- Group As Integer 'Tool group, Color group or no group
- Down As Integer 'True = Down, False = Up
- stuck As Integer 'True = Stuck down, False = Normal
- End Type
-
- Type BMP
- ID As Integer 'Used to verify if a bitmap data file is valid
- Changed As Integer 'Flag set when the master bitmap has been altered
- ButtonHeight As Integer
- ButtonWidth As Integer
- Position As Integer 'The current position in the master bitmap
- Border As Integer 'Thickness of borders of buttons on the master bitmap
- Buttons As Integer 'Which buttons to save (up, down & disabled)
- End Type
- Global BitMap As BMP
-
- Type Rect
- rLeft As Integer
- rTop As Integer
- rRight As Integer
- rBottom As Integer
- End Type
- Global Box As Rect 'Used to hold the values of the corners of the drawing area
-
- 'Used to fill the above Rect in one move
- Declare Sub SetRect Lib "user" (Box As Rect, ByVal x1%, ByVal y1%, ByVal x2%, ByVal y2%)
- 'Used to copy and stretch the pictures
- Declare Sub BitBlt Lib "GDI" (ByVal hDestDC%, ByVal X%, ByVal Y%, ByVal nWidth%, ByVal nHeight%, ByVal hSrcDC%, ByVal XSrc%, ByVal YSrc%, ByVal dwRop As Long)
- Declare Sub StretchBlt Lib "GDI" (ByVal hDestDC%, ByVal X%, ByVal Y%, ByVal nWidth%, ByVal nHeight%, ByVal hSrcDC%, ByVal XSrc%, ByVal YSrc%, ByVal XWidth%, ByVal YHeight%, ByVal dwRop As Long)
- 'Gets various system values
- Declare Function getSystemMetrics Lib "User" (ByVal intAns%) As Integer
-
- Global Editing As Integer
- Global HelpItem As Integer 'Used in Cheap_Help
- Global B(0 To 2) As picturebox 'Picturebox variable
- Global UpDated As Integer 'Flag used to indicate if the disabled button needs re-drawing
- Global GroupName As String 'Root name used to save files
- Global ButtonChanged As Integer 'Flag used to indicate if the button has changed
- Global CurrentDirectory As String 'The directory last used to load or save files
- Global CR As String 'Carriage return/Line feed
- Global BitMapLoaded As Integer 'Flag set when a bitmap is loaded
-
- 'TOOL VALUES
- Global Const T_FILL = 1
- Global Const T_PEN = 2
- Global Const T_LINE = 3
- Global Const T_BOX = 4
- Global Const T_BOXFILL = 5
- Global Const T_CIRCLE = 6
- Global Const T_CIRCLEFILL = 7
-
- 'BUTTON VALUES
- Global Const NO_GROUP = False
- Global Const COLOR_GROUP = 1
- Global Const TOOL_GROUP = 2
- Global Const TOTAL_BUTTONS = 32
- Global Const WIDTH_OF_BUTTONS = 29 '=Width of button + (the border width * 2)
- Global Const HEIGHT_OF_BUTTONS = 29 '=height of button + (the border height * 2)
-
- 'BitBlt & StretchBlt API Constants
- Global Const SRCCOPY = &HCC0020
- Global Const SRCAND = &H8800C6
- Global Const DSTINVERT = &H550009
- Global Const NOTSRCCOPY = &H330008
-
- 'GetSystemMetrics API constants
- Global Const SM_CXBORDER = 5 'Use to get the thickness in
- Global Const SM_CYBORDER = 6 'pixels of the picturebox frames
- Global Const SM_MOUSEPRESENT = 19
- 'SAVE VALUES
- Global Const NOT_SAVED = 32
- Global Const CANCEL_SAVE = 16
- Global Const SAVED = 0
- Global Const S_INDIVIDUAL_FILE = 1
- Global Const S_TO_BITMAP = 2
- Global Const S_BITMAP = 4
- Global Const S_TO_BITMAP_AND_FILE = 8
- Global Const S_SHOW_ALL = 15
- Global Const SAVE_CHANGES = " changed. Do you want to save the changes?"
- Global Const BUT_CHANGED = "The current button has"
- Global Const BIT_CHANGED = "The multi-button bitmap has"
- Global Const BOTH_CHANGED = "The current button && multi-button bitmap have"
- Global Const S_TYPE_INDIVIDUAL = 1
- Global Const S_TYPE_BITMAP = 2
-
- 'BUTTON NUMBERS
- Global Const BUTTON_BLACK = 0
- Global Const BUTTON_FILL = 16
- Global Const BUTTON_PEN = 17
- Global Const BUTTON_LINE = 18
- Global Const BUTTON_BOX = 19
- Global Const BUTTON_BOXFILL = 20
- Global Const BUTTON_CIRCLE = 21
- Global Const BUTTON_CIRCLEFILL = 22
- Global Const BUTTON_RESIZE = 24
- Global Const BUTTON_NEXT = 25
- Global Const BUTTON_UPDATE = 26
- Global Const BUTTON_SAVE = 27
- Global Const BUTTON_CLEAR = 28
- Global Const BUTTON_LOAD = 29
- Global Const BUTTON_VIEW = 30
- Global Const BUTTON_PRINT = 31
-
- 'Button ID
- Global Const BUTTON_ID = 6313
-
- ' I couldn't afford the VB help compiler so
- ' this is the next best thing
- Sub Cheap_Help (HelpPos As String)
- Dim FilePath As String
- Dim Temp As String
- Dim Msg As String
- Dim HelpFound As Integer
- Dim handle As Integer
-
- If Len(HelpPos) < 1 Then HelpPos = "0"
-
- On Error GoTo NoHelp
- FilePath = app.Path
- If Right$(FilePath, 1) <> "\" Then FilePath = FilePath & "\"
- FilePath = FilePath & "Buttons.aid"
-
- handle = FreeFile
-
- Open FilePath For Input As #handle
- Do Until EOF(handle)
- Line Input #handle, Temp
- If Left$(Temp, Len(HelpPos)) = HelpPos Then
- HelpFound = True
- Do
- Line Input #handle, Temp
- If Left$(Temp, 1) = Chr$(167) Then Exit Do
- Msg = Msg & Temp & CR
- Loop Until EOF(handle)
- Exit Do
- End If
- Loop
- Close #handle
-
- If HelpFound Then
- frmHelp!tbxHelp = Msg
- frmHelp.Show 1
- Else
- Error 32767
- End If
-
- GoOut:
- Exit Sub
-
- NoHelp:
- Select Case Err
- Case 32767
- Msg = "No help available for that subject"
- Case Else
- Msg = "Unable to load Help" & CR & Error$
- End Select
-
- MsgBox Msg, 0, "Help"
- Resume GoOut
-
- End Sub
-
- ' Checks that any drawing that's about to be done is
- ' inside the drawing area on the button
- Function Inside_Array (X As Integer, Y As Integer) As Integer
- Inside_Array = True
- If X < Box.rLeft Or X > Box.rRight Then Inside_Array = False
- If Y < Box.rTop Or Y > Box.rBottom Then Inside_Array = False
- End Function
-
- ' Centres forms
- Sub Position_Form (tForm As Form)
- tForm.Move (Screen.Width - tForm.Width) \ 2, (Screen.Height - tForm.Height) \ 2
- End Sub
-
- ' Any black pixel on the 'Up' button is plotted on the disabled button
- ' as dark grey and a white pixel is drawn to the right and below
- ' Any dark grey pixel is copied without change
- Sub Update_Button ()
-
- If Not UpDated Then frmUpdate.Show 1
-
- End Sub
-
-